package com.slipper.system.backup.service;

import com.slipper.common.service.CommonService;
import static com.slipper.constants.Constants.Database.*;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class QuartzRestoreService {
    @Resource
    protected CommonService commonService;

    private final String[] mysqlDdlList = new String[] {
            "drop table if exists q_fired_triggers",
            "drop table if exists q_paused_trigger_grps",
            "drop table if exists q_scheduler_state",
            "drop table if exists q_locks",
            "drop table if exists q_simple_triggers",
            "drop table if exists q_simprop_triggers",
            "drop table if exists q_cron_triggers",
            "drop table if exists q_blob_triggers",
            "drop table if exists q_triggers",
            "drop table if exists q_job_details",
            "drop table if exists q_calendars",
            "create table q_job_details(sched_name varchar(120) not null, job_name varchar(190) not null, job_group varchar(190) not null, description varchar(250) null, job_class_name varchar(250) not null, is_durable varchar(1) not null, is_nonconcurrent varchar(1) not null, is_update_data varchar(1) not null, requests_recovery varchar(1) not null, job_data blob null, primary key(sched_name,job_name,job_group)) engine=innodb",
            "create table q_triggers(sched_name varchar(120) not null, trigger_name varchar(190) not null, trigger_group varchar(190) not null, job_name varchar(190) not null, job_group varchar(190) not null, description varchar(250) null, next_fire_time bigint(13) null, prev_fire_time bigint(13) null, priority integer null, trigger_state varchar(16) not null, trigger_type varchar(8) not null, start_time bigint(13) not null, end_time bigint(13) null, calendar_name varchar(190) null, misfire_instr smallint(2) null, job_data blob null, primary key(sched_name,trigger_name,trigger_group), foreign key(sched_name,job_name,job_group) references q_job_details(sched_name,job_name,job_group)) engine=innodb",
            "create table q_simple_triggers(sched_name varchar(120) not null, trigger_name varchar(190) not null, trigger_group varchar(190) not null, repeat_count bigint(7) not null, repeat_interval bigint(12) not null, times_triggered bigint(10) not null, primary key(sched_name,trigger_name,trigger_group), foreign key(sched_name,trigger_name,trigger_group) references q_triggers(sched_name,trigger_name,trigger_group)) engine=innodb",
            "create table q_cron_triggers(sched_name varchar(120) not null, trigger_name varchar(190) not null, trigger_group varchar(190) not null, cron_expression varchar(120) not null, time_zone_id varchar(80), primary key(sched_name,trigger_name,trigger_group), foreign key(sched_name,trigger_name,trigger_group) references q_triggers(sched_name,trigger_name,trigger_group)) engine=innodb",
            "create table q_simprop_triggers(sched_name varchar(120) not null, trigger_name varchar(190) not null, trigger_group varchar(190) not null, str_prop_1 varchar(512) null, str_prop_2 varchar(512) null, str_prop_3 varchar(512) null, int_prop_1 int null, int_prop_2 int null, long_prop_1 bigint null, long_prop_2 bigint null, dec_prop_1 numeric(13,4) null, dec_prop_2 numeric(13,4) null, bool_prop_1 varchar(1) null, bool_prop_2 varchar(1) null, primary key(sched_name,trigger_name,trigger_group), foreign key(sched_name,trigger_name,trigger_group)     references q_triggers(sched_name,trigger_name,trigger_group)) engine=innodb",
            "create table q_blob_triggers(sched_name varchar(120) not null, trigger_name varchar(190) not null, trigger_group varchar(190) not null, blob_data blob null, primary key(sched_name,trigger_name,trigger_group), index(sched_name,trigger_name, trigger_group), foreign key(sched_name,trigger_name,trigger_group) references q_triggers(sched_name,trigger_name,trigger_group)) engine=innodb",
            "create table q_calendars(sched_name varchar(120) not null, calendar_name varchar(190) not null, calendar blob not null, primary key(sched_name,calendar_name)) engine=innodb",
            "create table q_paused_trigger_grps(sched_name varchar(120) not null, trigger_group varchar(190) not null, primary key(sched_name,trigger_group)) engine=innodb",
            "create table q_fired_triggers(sched_name varchar(120) not null, entry_id varchar(95) not null, trigger_name varchar(190) not null, trigger_group varchar(190) not null, instance_name varchar(190) not null, fired_time bigint(13) not null, sched_time bigint(13) not null, priority integer not null, state varchar(16) not null, job_name varchar(190) null, job_group varchar(190) null, is_nonconcurrent varchar(1) null, requests_recovery varchar(1) null, primary key(sched_name,entry_id)) engine=innodb",
            "create table q_scheduler_state(sched_name varchar(120) not null, instance_name varchar(190) not null, last_checkin_time bigint(13) not null, checkin_interval bigint(13) not null, primary key(sched_name,instance_name)) engine=innodb",
            "create table q_locks(sched_name varchar(120) not null, lock_name varchar(40) not null, primary key(sched_name,lock_name)) engine=innodb",
            "create index idx_q_j_req_recovery on q_job_details(sched_name,requests_recovery)",
            "create index idx_q_j_grp on q_job_details(sched_name,job_group)",
            "create index idx_q_t_j on q_triggers(sched_name,job_name,job_group)",
            "create index idx_q_t_jg on q_triggers(sched_name,job_group)",
            "create index idx_q_t_c on q_triggers(sched_name,calendar_name)",
            "create index idx_q_t_g on q_triggers(sched_name,trigger_group)",
            "create index idx_q_t_state on q_triggers(sched_name,trigger_state)",
            "create index idx_q_t_n_state on q_triggers(sched_name,trigger_name,trigger_group,trigger_state)",
            "create index idx_q_t_n_g_state on q_triggers(sched_name,trigger_group,trigger_state)",
            "create index idx_q_t_next_fire_time on q_triggers(sched_name,next_fire_time)",
            "create index idx_q_t_nft_st on q_triggers(sched_name,trigger_state,next_fire_time)",
            "create index idx_q_t_nft_misfire on q_triggers(sched_name,misfire_instr,next_fire_time)",
            "create index idx_q_t_nft_st_misfire on q_triggers(sched_name,misfire_instr,next_fire_time,trigger_state)",
            "create index idx_q_t_nft_st_misfire_grp on q_triggers(sched_name,misfire_instr,next_fire_time,trigger_group,trigger_state)",
            "create index idx_q_ft_trig_inst_name on q_fired_triggers(sched_name,instance_name)",
            "create index idx_q_ft_inst_job_req_rcvry on q_fired_triggers(sched_name,instance_name,requests_recovery)",
            "create index idx_q_ft_j_g on q_fired_triggers(sched_name,job_name,job_group)",
            "create index idx_q_ft_jg on q_fired_triggers(sched_name,job_group)",
            "create index idx_q_ft_t_g on q_fired_triggers(sched_name,trigger_name,trigger_group)",
            "create index idx_q_ft_tg on q_fired_triggers(sched_name,trigger_group)"
    };

    private final String[] postgresDdlList = new String[] {
            "drop table if exists q_fired_triggers",
            "drop table if exists q_paused_trigger_grps",
            "drop table if exists q_scheduler_state",
            "drop table if exists q_locks",
            "drop table if exists q_simple_triggers",
            "drop table if exists q_cron_triggers",
            "drop table if exists q_simprop_triggers",
            "drop table if exists q_blob_triggers",
            "drop table if exists q_triggers",
            "drop table if exists q_job_details",
            "drop table if exists q_calendars",
            "create table q_job_details(sched_name varchar(120) not null, job_name varchar(200) not null, job_group varchar(200) not null, description varchar(250) null, job_class_name varchar(250) not null, is_durable bool not null, is_nonconcurrent bool not null, is_update_data bool not null, requests_recovery bool not null, job_data bytea null, primary key(sched_name, job_name, job_group))",
            "create table q_triggers(sched_name varchar(120) not null, trigger_name varchar(200) not null, trigger_group varchar(200) not null, job_name varchar(200) not null, job_group varchar(200) not null, description varchar(250) null, next_fire_time bigint null, prev_fire_time bigint null, priority integer null, trigger_state varchar(16) not null, trigger_type varchar(8) not null, start_time bigint not null, end_time bigint null, calendar_name varchar(200) null, misfire_instr smallint null, job_data bytea null, primary key(sched_name, trigger_name, trigger_group), foreign key(sched_name, job_name, job_group) references q_job_details(sched_name, job_name, job_group))",
            "create table q_simple_triggers(sched_name varchar(120) not null, trigger_name varchar(200) not null, trigger_group varchar(200) not null, repeat_count bigint not null, repeat_interval bigint not null, times_triggered bigint not null, primary key(sched_name, trigger_name, trigger_group), foreign key(sched_name, trigger_name, trigger_group) references q_triggers(sched_name, trigger_name, trigger_group))",
            "create table q_cron_triggers(sched_name varchar(120) not null, trigger_name varchar(200) not null, trigger_group varchar(200) not null, cron_expression varchar(120) not null, time_zone_id varchar(80), primary key(sched_name, trigger_name, trigger_group), foreign key(sched_name, trigger_name, trigger_group) references q_triggers(sched_name, trigger_name, trigger_group))",
            "create table q_simprop_triggers(sched_name varchar(120) not null, trigger_name varchar(200) not null, trigger_group varchar(200) not null, str_prop_1 varchar(512) null, str_prop_2 varchar(512) null, str_prop_3 varchar(512) null, int_prop_1 int null, int_prop_2 int null, long_prop_1 bigint null, long_prop_2 bigint null, dec_prop_1 numeric(13, 4) null, dec_prop_2 numeric(13, 4) null, bool_prop_1 bool null, bool_prop_2 bool null, primary key(sched_name, trigger_name, trigger_group), foreign key(sched_name, trigger_name, trigger_group) references q_triggers(sched_name, trigger_name, trigger_group))",
            "create table q_blob_triggers(sched_name varchar(120) not null, trigger_name varchar(200) not null, trigger_group varchar(200) not null, blob_data bytea null, primary key(sched_name, trigger_name, trigger_group), foreign key(sched_name, trigger_name, trigger_group) references q_triggers(sched_name, trigger_name, trigger_group))",
            "create table q_calendars(sched_name varchar(120) not null, calendar_name varchar(200) not null, calendar bytea not null, primary key(sched_name, calendar_name))",
            "create table q_paused_trigger_grps(sched_name varchar(120) not null, trigger_group varchar(200) not null, primary key(sched_name, trigger_group))",
            "create table q_fired_triggers(sched_name varchar(120) not null, entry_id varchar(95) not null, trigger_name varchar(200) not null, trigger_group varchar(200) not null, instance_name varchar(200) not null, fired_time bigint not null, sched_time bigint not null, priority integer not null, state varchar(16) not null, job_name varchar(200) null, job_group varchar(200) null, is_nonconcurrent bool null, requests_recovery bool null, primary key(sched_name, entry_id))",
            "create table q_scheduler_state(sched_name varchar(120) not null, instance_name varchar(200) not null, last_checkin_time bigint not null, checkin_interval bigint not null, primary key(sched_name, instance_name) )",
            "create table q_locks(sched_name varchar(120) not null, lock_name varchar(40) not null, primary key(sched_name, lock_name))",
            "create index idx_q_j_req_recovery on q_job_details(sched_name, requests_recovery)",
            "create index idx_q_j_grp on q_job_details(sched_name, job_group)",
            "create index idx_q_t_j on q_triggers(sched_name, job_name, job_group)",
            "create index idx_q_t_jg on q_triggers(sched_name, job_group)",
            "create index idx_q_t_c on q_triggers(sched_name, calendar_name)",
            "create index idx_q_t_g on q_triggers(sched_name, trigger_group)",
            "create index idx_q_t_state on q_triggers(sched_name, trigger_state)",
            "create index idx_q_t_n_state on q_triggers(sched_name, trigger_name, trigger_group, trigger_state)",
            "create index idx_q_t_n_g_state on q_triggers(sched_name, trigger_group, trigger_state)",
            "create index idx_q_t_next_fire_time on q_triggers(sched_name, next_fire_time)",
            "create index idx_q_t_nft_st on q_triggers(sched_name, trigger_state, next_fire_time)",
            "create index idx_q_t_nft_misfire on q_triggers(sched_name, misfire_instr, next_fire_time)",
            "create index idx_q_t_nft_st_misfire on q_triggers(sched_name, misfire_instr, next_fire_time, trigger_state)",
            "create index idx_q_t_nft_st_misfire_grp on q_triggers(sched_name, misfire_instr, next_fire_time, trigger_group, trigger_state)",
            "create index idx_q_ft_trig_inst_name on q_fired_triggers(sched_name, instance_name)",
            "create index idx_q_ft_inst_job_req_rcvry on q_fired_triggers(sched_name, instance_name, requests_recovery)",
            "create index idx_q_ft_j_g on q_fired_triggers(sched_name, job_name, job_group)",
            "create index idx_q_ft_jg on q_fired_triggers(sched_name, job_group)",
            "create index idx_q_ft_t_g on q_fired_triggers(sched_name, trigger_name, trigger_group)",
            "create index idx_q_ft_tg on q_fired_triggers(sched_name, trigger_group)"
    };

    private final String[] sqlserverDdlList = new String[] {
            "CREATE TABLE [Q_CALENDARS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [CALENDAR_NAME] [VARCHAR] (200) NOT NULL, [CALENDAR] [IMAGE] NOT NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_CRON_TRIGGERS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [TRIGGER_NAME] [VARCHAR] (200) NOT NULL, [TRIGGER_GROUP] [VARCHAR] (200) NOT NULL, [CRON_EXPRESSION] [VARCHAR] (120) NOT NULL, [TIME_ZONE_ID] [VARCHAR] (80)) ON [PRIMARY]",
            "CREATE TABLE [Q_FIRED_TRIGGERS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [ENTRY_ID] [VARCHAR] (95) NOT NULL, [TRIGGER_NAME] [VARCHAR] (200) NOT NULL, [TRIGGER_GROUP] [VARCHAR] (200) NOT NULL, [INSTANCE_NAME] [VARCHAR] (200) NOT NULL, [FIRED_TIME] [BIGINT] NOT NULL, [SCHED_TIME] [BIGINT] NOT NULL, [PRIORITY] [INTEGER] NOT NULL, [STATE] [VARCHAR] (16) NOT NULL, [JOB_NAME] [VARCHAR] (200) NULL, [JOB_GROUP] [VARCHAR] (200) NULL, [IS_NONCONCURRENT] [VARCHAR] (1) NULL, [REQUESTS_RECOVERY] [VARCHAR] (1) NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_PAUSED_TRIGGER_GRPS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [TRIGGER_GROUP] [VARCHAR] (200) NOT NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_SCHEDULER_STATE]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [INSTANCE_NAME] [VARCHAR] (200) NOT NULL, [LAST_CHECKIN_TIME] [BIGINT] NOT NULL, [CHECKIN_INTERVAL] [BIGINT] NOT NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_LOCKS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [LOCK_NAME] [VARCHAR] (40) NOT NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_JOB_DETAILS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [JOB_NAME] [VARCHAR] (200) NOT NULL, [JOB_GROUP] [VARCHAR] (200) NOT NULL, [DESCRIPTION] [VARCHAR] (250) NULL, [JOB_CLASS_NAME] [VARCHAR] (250) NOT NULL, [IS_DURABLE] [VARCHAR] (1) NOT NULL, [IS_NONCONCURRENT] [VARCHAR] (1) NOT NULL, [IS_UPDATE_DATA] [VARCHAR] (1) NOT NULL, [REQUESTS_RECOVERY] [VARCHAR] (1) NOT NULL, [JOB_DATA] [IMAGE] NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_SIMPLE_TRIGGERS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [TRIGGER_NAME] [VARCHAR] (200) NOT NULL, [TRIGGER_GROUP] [VARCHAR] (200) NOT NULL, [REPEAT_COUNT] [BIGINT] NOT NULL, [REPEAT_INTERVAL] [BIGINT] NOT NULL, [TIMES_TRIGGERED] [BIGINT] NOT NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_SIMPROP_TRIGGERS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [TRIGGER_NAME] [VARCHAR] (200) NOT NULL, [TRIGGER_GROUP] [VARCHAR] (200) NOT NULL, [STR_PROP_1] [VARCHAR] (512) NULL, [STR_PROP_2] [VARCHAR] (512) NULL, [STR_PROP_3] [VARCHAR] (512) NULL, [INT_PROP_1] [INT] NULL, [INT_PROP_2] [INT] NULL, [LONG_PROP_1] [BIGINT] NULL, [LONG_PROP_2] [BIGINT] NULL, [DEC_PROP_1] [NUMERIC] (13,4) NULL, [DEC_PROP_2] [NUMERIC] (13,4) NULL, [BOOL_PROP_1] [VARCHAR] (1) NULL, [BOOL_PROP_2] [VARCHAR] (1) NULL,) ON [PRIMARY]",
            "CREATE TABLE [Q_BLOB_TRIGGERS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [TRIGGER_NAME] [VARCHAR] (200) NOT NULL, [TRIGGER_GROUP] [VARCHAR] (200) NOT NULL, [BLOB_DATA] [IMAGE] NULL) ON [PRIMARY]",
            "CREATE TABLE [Q_TRIGGERS]([SCHED_NAME] [VARCHAR] (120) NOT NULL, [TRIGGER_NAME] [VARCHAR] (200) NOT NULL, [TRIGGER_GROUP] [VARCHAR] (200) NOT NULL, [JOB_NAME] [VARCHAR] (200) NOT NULL, [JOB_GROUP] [VARCHAR] (200) NOT NULL, [DESCRIPTION] [VARCHAR] (250) NULL, [NEXT_FIRE_TIME] [BIGINT] NULL, [PREV_FIRE_TIME] [BIGINT] NULL, [PRIORITY] [INTEGER] NULL, [TRIGGER_STATE] [VARCHAR] (16) NOT NULL, [TRIGGER_TYPE] [VARCHAR] (8) NOT NULL, [START_TIME] [BIGINT] NOT NULL, [END_TIME] [BIGINT] NULL, [CALENDAR_NAME] [VARCHAR] (200) NULL, [MISFIRE_INSTR] [SMALLINT] NULL, [JOB_DATA] [IMAGE] NULL) ON [PRIMARY]",
            "ALTER TABLE [Q_CALENDARS] WITH NOCHECK ADD CONSTRAINT [PK_Q_CALENDARS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [CALENDAR_NAME]) ON [PRIMARY]",
            "ALTER TABLE [Q_CRON_TRIGGERS] WITH NOCHECK ADD CONSTRAINT [PK_Q_CRON_TRIGGERS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON [PRIMARY]",
            "ALTER TABLE [Q_FIRED_TRIGGERS] WITH NOCHECK ADD CONSTRAINT [PK_Q_FIRED_TRIGGERS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [ENTRY_ID]) ON [PRIMARY]",
            "ALTER TABLE [Q_PAUSED_TRIGGER_GRPS] WITH NOCHECK ADD CONSTRAINT [PK_Q_PAUSED_TRIGGER_GRPS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [TRIGGER_GROUP]) ON [PRIMARY]",
            "ALTER TABLE [Q_SCHEDULER_STATE] WITH NOCHECK ADD CONSTRAINT [PK_Q_SCHEDULER_STATE] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [INSTANCE_NAME]) ON [PRIMARY]",
            "ALTER TABLE [Q_LOCKS] WITH NOCHECK ADD CONSTRAINT [PK_Q_LOCKS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [LOCK_NAME]) ON [PRIMARY]",
            "ALTER TABLE [Q_JOB_DETAILS] WITH NOCHECK ADD CONSTRAINT [PK_Q_JOB_DETAILS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [JOB_NAME],  [JOB_GROUP]) ON [PRIMARY]",
            "ALTER TABLE [Q_SIMPLE_TRIGGERS] WITH NOCHECK ADD CONSTRAINT [PK_Q_SIMPLE_TRIGGERS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON [PRIMARY]",
            "ALTER TABLE [Q_SIMPROP_TRIGGERS] WITH NOCHECK ADD CONSTRAINT [PK_Q_SIMPROP_TRIGGERS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON [PRIMARY]",
            "ALTER TABLE [Q_TRIGGERS] WITH NOCHECK ADD CONSTRAINT [PK_Q_TRIGGERS] PRIMARY KEY CLUSTERED( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON [PRIMARY]",
            "ALTER TABLE [Q_CRON_TRIGGERS] ADD CONSTRAINT [FK_Q_CRON_TRIGGERS_Q_TRIGGERS] FOREIGN KEY( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) REFERENCES [Q_TRIGGERS]( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON DELETE CASCADE",
            "ALTER TABLE [Q_SIMPLE_TRIGGERS] ADD CONSTRAINT [FK_Q_SIMPLE_TRIGGERS_Q_TRIGGERS] FOREIGN KEY( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) REFERENCES [Q_TRIGGERS]( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON DELETE CASCADE",
            "ALTER TABLE [Q_SIMPROP_TRIGGERS] ADD CONSTRAINT [FK_Q_SIMPROP_TRIGGERS_Q_TRIGGERS] FOREIGN KEY( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) REFERENCES [Q_TRIGGERS]( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON DELETE CASCADE",
            "ALTER TABLE [Q_BLOB_TRIGGERS] ADD CONSTRAINT [FK_Q_BLOB_TRIGGERS_Q_TRIGGERS] FOREIGN KEY( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) REFERENCES [Q_TRIGGERS]( [SCHED_NAME],  [TRIGGER_NAME],  [TRIGGER_GROUP]) ON DELETE CASCADE",
            "ALTER TABLE [Q_TRIGGERS] ADD CONSTRAINT [FK_Q_TRIGGERS_Q_JOB_DETAILS] FOREIGN KEY( [SCHED_NAME],  [JOB_NAME],  [JOB_GROUP]) REFERENCES [Q_JOB_DETAILS]( [SCHED_NAME],  [JOB_NAME],  [JOB_GROUP])",
    };

    public void restore(String dbType) {
        String[] ddlList = new String[0];
        if (MYSQL.equalsIgnoreCase(dbType)) {
            ddlList = mysqlDdlList;
        } else if (POSTGRESQL.equalsIgnoreCase(dbType)) {
            ddlList = postgresDdlList;
        } else if (SQLSERVER.equalsIgnoreCase(dbType)) {
            ddlList = sqlserverDdlList;
        }

        for (String ddl : ddlList) {
            commonService.executeDDL(ddl);
        }
    }
}
